
import 'package:basic_common/app_theme.dart';
import 'package:basic_common/common_exports.dart';
import 'package:basic_patient/childview/patienthealth/patient_health_controller.dart';
import 'package:basic_patient/childview/patienthealth/view/item_widget.dart';
import 'package:basic_widgets/bg_widget.dart';
import 'package:basic_widgets/text_widget.dart';

class HealthInfoWidget extends GetView<PatientHealthController> {
  const HealthInfoWidget({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SingleChildScrollView(
        physics: AlwaysScrollableScrollPhysics(),
        child: Column(
          children: [
            solidConnerContainer(
              width: ScreenHelper.screenWidth,
              height: ScreenHelper.height(200),
              bgColor: Colors.white,
              child: ListView.separated(
                physics: NeverScrollableScrollPhysics(),
                shrinkWrap: true,
                itemBuilder: (BuildContext context, int index) {
                  Map item = controller.heathInfoList[index];
                  return buildItem(
                    attrName: item['attr'],
                    value: item['value'],
                  );
                },
                itemCount: controller.heathInfoList.length,
                separatorBuilder: (context, index) => divider(),
              ),
            ),
            SizedBox(height: ScreenHelper.height(10)),
            Container(color: AppTheme.appBgColor, child: norTitle(title: "生活习惯")),
            solidConnerContainer(
              width: ScreenHelper.screenWidth,
              height: ScreenHelper.height(300),
              bgColor: Colors.white,
              child: ListView.separated(
                shrinkWrap: true,
                physics: const NeverScrollableScrollPhysics(),
                itemBuilder: (BuildContext context, int index) {
                  Map item = controller.habitList[index];
                  return buildItem(
                    attrName: item['attr'],
                    value: item['value'],
                  );
                },
                itemCount: controller.habitList.length,
                separatorBuilder: (context, index) => divider(),
              ),
            ),
            SizedBox(height: ScreenHelper.height(10)),
            Container(color: AppTheme.appBgColor, child: norTitle(title: "健康史")),
            solidConnerContainer(
              width: ScreenHelper.screenWidth,
              height: ScreenHelper.height(200),
              bgColor: Colors.white,
              child: ListView.separated(
                shrinkWrap: true,
                physics: const NeverScrollableScrollPhysics(),
                itemBuilder: (BuildContext context, int index) {
                  Map item = controller.healthHistoryList[index];
                  return buildItem(
                    attrName: item['attr'],
                    value: item['value'],
                  );
                },
                itemCount: controller.healthHistoryList.length,
                separatorBuilder: (context, index) => divider(),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
